package com.netease.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

/**
 * Created by dongle on 2017/3/6.
 */
@Controller
public class DemoController {
    @Autowired
    private RestController restController;

    @RequestMapping(value = "/restartdemo", method = RequestMethod.GET)
    public String restartDemo(Model model) throws IOException {
        return "restartdemo";
    }

    @RequestMapping(value = "/restartdemo", method = RequestMethod.POST)
    public String restartDemo(@RequestParam String spaceName, @RequestParam String serviceName, @RequestParam String restartOption, Model model) throws IOException {
        String result = restController.rebootServiceByName(spaceName, serviceName, restartOption);
        model.addAttribute("msg", "已重启");
        return "restartdemo";
    }

}
